import { defineConfig, loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'
export default defineConfig(({ command, mode }) => {
  // 获取.env文件中配置的环境变量
  const env = loadEnv(mode, process.cwd(), "");
  return {
    plugins: [vue()],
    resolve: {
      alias: {
        "@": resolve(__dirname, "./src"),
      },
    },
    base: "./",
    build: {
      rollupOptions: {
        output: {
          manualChunks: {
            // lodash: ["lodash"],
            // echarts: ["echarts"],
          },
        },
      },
    },
    server: {
      host: env.HOST,
      port: env.PORT,
    } as any,
  };
});
